 const state ={
       address:JSON.parse(uni.getStorageSync('ADDRESS') || '{}'),
       token:uni.getStorageSync('TOKEN') || '',
       //用户信息
       userinfo:JSON.parse(uni.getStorageSync('userinfo') || '{}'),
       // 重定向的 object 对象 { openType, from }
         redirectInfo: null
 }
 
 const mutations ={
   //接收收货地址
   updateAddress(state,address){
     state.address = address
     this.commit('saveAddressTostorage')
   },
   // 收获地址永久化存储
   saveAddressTostorage(state){
     uni.setStorageSync('ADDRESS',JSON.stringify(state.address))
   },
   // 更新用户信息
   UpdateUserInfo(state,userinfo){
     state.userinfo = userinfo
     this.commit('saveUserInfoTostorage')
   },
   //用户信息本地化存储
   saveUserInfoTostorage(state){
     uni.setStorageSync('USERINFO',JSON.stringify(state.userinfo))
   },
   // token
   UpdateToken(state,token){
     state.token = token
     this.commit('saveTokenTostorage')
   },
   //token本地化存储
   saveTokenTostorage(state){
     uni.setStorageSync('TOKEN',state.token)
   },
   
   UpdateRedirectInfo(state,info){
     state.redirectInfo = info
     console.log(state.redirectInfo);
   }
 }
 
 const actions ={
   
 }
 
 const getters ={
   addstr(state){
      if(!state.address.provinceName) return ''
      
      return state.address.provinceName + state.address.cityName + state.address.countyName + state.address.detailInfo
   }
 }
 
 export default  {
   state,
   mutations,
   actions,
   getters
 }